﻿using PJTY.dal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class sp3update : System.Web.UI.Page
{
    DataClasses1DataContext db = new DataClasses1DataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack & Request.QueryString["Producttypeid"] != null)
        {

            int producttypeid=int.Parse(Request.QueryString["Producttypeid"]);           
             
            var Producttype= (from r in db.Producttype where r.Producttypeid == producttypeid select r).First();

            TextBox1.ReadOnly = true;
            TextBox1.Text= Producttype.Producttypeid.ToString();
            TextBox2.Text = Producttype.typename;
            TextBox3.Text = Producttype.typems;
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        var Producttype = (from r in db.Producttype where r.Producttypeid == int.Parse(TextBox1.Text) select r).First();
        Producttype.typename = TextBox2.Text;
        Producttype.typems = TextBox3.Text;
        db.SubmitChanges();
        Response.Redirect("~/views/customer/sp3.aspx");
    }
}